/*
 * @Author       : NaN 353362604@qq.com
 * @Date         : 2023-06-09 15:10:13
 * @LastEditTime : 2023-06-27 14:57:37
 * @LastEditors  : NaN 353362604@qq.com
 * @FilePath     : \AdminStration\src\Common\Router\MenuNav\TwoRouter\CameraGroupDetail.jsx
 * @Description  :
 */
import { API_LIST } from '../../../Api/Api'
import { commonTableList } from '../Common/common'
import { DelDataButton, OpenThrTouter } from '../Common/options'
import { ProjectList } from '../Common/Conversion'

export const CameraGroupDetail = async ({ OptionsEvent, oneData, Permission, actionRef, ClientData }) => {
    const { hostname } = window.location
    let dataList = {
        pageSize: 10,
        params: { cameraGroupUuid: oneData.uuid },
        hideInSearch: !hostname.includes('jszx'),
        get: API_LIST([oneData.uuid])['getCameraGroupDetail'],
        options: [
            Permission.findIndex(v => v.uuid === '641f2b6e-8a50-48d2-9b50-b972e997128a') !== -1 && (
                <OpenThrTouter
                    title="添加摄像头"
                    type="primary"
                    icon="add"
                    modal="SelectModal"
                    OptionsEvent={OptionsEvent}
                    other={{
                        page: 'CameraGroupDetail',
                        actionRef,
                        Permission,
                        twoData: oneData,
                    }}
                />
            ),
        ],
        columns: [
            {
                title: '摄像头编号',
                dataIndex: 'cameraUuid',
                search: false,
                type: 'hidden',
                hideInTable: true,
            },
            {
                dataIndex: 'cameraName',
                title: '名称',
                valueType: 'input',
                width: 200,
            },
            {
                ...commonTableList.projectUuid,
                valueEnum: await ProjectList(),
                hideInAdded: true,
                hideInModify: true,
                hideInTable: true,
                hideInSearch: !hostname.includes('jszx'),
            },
            {
                dataIndex: 'organizationName',
                title: '组织机构',
                valueType: 'input',
                width: 200,
                hideInSearch: true,
            },
            {
                dataIndex: 'cameraPositionName',
                title: '位置',
                valueType: 'input',
                width: 200,
                hideInSearch: true,
            },
            {
                dataIndex: 'cameraTypeName',
                title: '类型',
                valueType: 'input',
                width: 200,
                hideInSearch: true,
            },
            {
                dataIndex: 'deviceSerial',
                title: '序列号',
                valueType: 'input',
                width: 200,
                hideInSearch: true,
            },
            {
                title: '操作',
                valueType: 'systemOperation',
                fixed: 'right',
                width: 100,
                hideInSearch: true,
                hideInAdded: true,
                hideInModify: true,
                render: (_, record) => {
                    return [
                        Permission.findIndex(v => v.uuid === '2413888c-13fa-40c3-9fcc-5f82e544c935') !== -1 && (
                            <DelDataButton
                                OptionsEvent={OptionsEvent}
                                key="del"
                                title="删除"
                                url="CameraGroupDetail"
                                uuid={record.uuid}
                            />
                        ),
                    ]
                },
            },
        ],
    }

    return dataList
}
